<?php

if (!$SCREEN == "DisplayCustomerNotes"){
	//$SCREEN = $SCREEN;
}

	if (($intCustomerNotesID) || ($intCustomerID)){ 
	    include (MODULE . "/action/qrySelectCustomerNotes");
		if(!$myrow[0]==""){
			do {
			
				echo "
			     <tr>
			         <td colspan='2'>
						<hr>
			         </td>
			     </tr>
	
			     <tr align='left'>
			         <td align='left'>
			             <b>Note created :</b>
						".ReformatFromMySqlDate(substr($myrow[TimeStamp],0,10))."&nbsp;".substr($myrow[TimeStamp],11,8)."&nbsp;by&nbsp;
				";
						if ($_SESSION['sesUserGroup'] == '3'){
							echo "<a href=\"JavaScript: newWindow = openWin( '" . ScreenURL("DisplayStaff",array('intStaffID'=>$myrow[Staff])) . "', 'DisplayStaff', 'width=800,height=600,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1' ); newWindow.focus()\">";
						}
						
						echo DisplayLookupValue("tblStaff","concat(FirstName,' ', Surname) FullName",$myrow[Staff]);
						if ($_SESSION['sesUserGroup'] == '3'){
							echo "</a>";
						}
				/*
				 * Removed delete as it was being abused, needs reinstating when qryDeleteCustomerNotes has
				 * a delete flag so notes remain but aren't displayed if marked as deleted.
				 * 
				 * <a href=\"" . ScreenURL($SCREEN,array('intCustomerNotesID'=>$myrow[0],'ACTION'=>"qryDeleteCustomerNotes",'intCustomerID'=>$intCustomerID) ) . "\"
			     *            onclick=\"return confirmLink(this, 'Delete note ".$myrow[0]."');\">delete</a>&nbsp;
				 * 
				 * 
				 */						
				echo "
					</td>
					<td align='right'>
						
						<a href='" . ScreenURL("EnterCustomerNotes",array('intCustomerNotesID'=>$myrow[0],'intCustomerID'=>$intCustomerID) ) . "'>
			             update</a>
					</td>
				</tr>
				";
	
				echo "
				     <tr  align='left'>
				         <td align='left' colspan='2'>";
						 //$strNewNote = addslashes($myrow["Note"]);
						 //eval("\$strNote = \" $myrow[Note] \";");
						//echo nl2br($strNote);		
						echo nl2br($myrow["Note"]);
							            
				echo "
				         </td>
				     </tr>
				";
				
				    //LONG
				
					if ($myrow[UploadedDocument] == "none"){
					}else{
						echo "
						     <tr>
						         <td align='left' colspan='2'>
						             <a href='./images/documents/".$myrow[UploadedDocument]."' target='_blank'> ".$myrow[UploadedDocument]."</a>
						         </td>
						     </tr>
						";
					}
				    //ELSE
				    //Nothing
	
			} while ($myrow = mysql_fetch_array($result));
			
		}else{
			echo "
			    <tr>
			         <td align='center' colspan='2'>
			              No Customer Notes.
			         </td>
			    </tr>
			";
		}
		
	}
?>

